import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Index',
    component: Index,
    children: [
      {
        path: '/home',
        name: 'Home',
        component: () => import('@/components/Home.vue')
      },
      {
        path: '/cate',
        name: 'Cate',
        component: () => import('@/components/Cate.vue')
      },
      {
        path: '/cart',
        name: 'Cart',
        component: () => import('@/components/Cart.vue')
      },
      {
        path: '/my',
        name: 'My',
        component: () => import('@/components/My.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue'),
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
